|
|
@@ -13,7 +13,7 @@ unless user.agents.where(:name => "SF Weather Agent").exists?
|
13
|
13
|
Agent.build_for_type("Agents::WeatherAgent", user,
|
14
|
14
|
:name => "SF Weather Agent",
|
15
|
15
|
:schedule => "10pm",
|
16
|
|
- :options => { :location => "94103", :api_key => "your-key" }).save!
|
|
16
|
+ :options => { 'location' => "94103", 'api_key' => "your-key" }).save!
|
17
|
17
|
end
|
18
|
18
|
|
19
|
19
|
unless user.agents.where(:name => "XKCD Source").exists?
|
|
|
@@ -22,12 +22,12 @@ unless user.agents.where(:name => "XKCD Source").exists?
|
22
|
22
|
:schedule => "every_1d",
|
23
|
23
|
:type => "html",
|
24
|
24
|
:options => {
|
25
|
|
- :url => "http://xkcd.com",
|
26
|
|
- :mode => "on_change",
|
27
|
|
- :expected_update_period_in_days => 5,
|
28
|
|
- :extract => {
|
29
|
|
- :url => {:css => "#comic img", :attr => "src"},
|
30
|
|
- :title => {:css => "#comic img", :attr => "title"}
|
|
25
|
+ 'url' => "http://xkcd.com",
|
|
26
|
+ 'mode' => "on_change",
|
|
27
|
+ 'expected_update_period_in_days' => 5,
|
|
28
|
+ 'extrac' => {
|
|
29
|
+ 'url' => { 'css' => "#comic img", 'attr' => "src" },
|
|
30
|
+ 'title' => { 'css' => "#comic img", 'attr' => "title" }
|
31
|
31
|
}
|
32
|
32
|
}).save!
|
33
|
33
|
end
|
|
|
@@ -36,13 +36,13 @@ unless user.agents.where(:name => "iTunes Trailer Source").exists?
|
36
|
36
|
Agent.build_for_type("Agents::WebsiteAgent", user, :name => "iTunes Trailer Source",
|
37
|
37
|
:schedule => "every_1d",
|
38
|
38
|
:options => {
|
39
|
|
- :url => "http://trailers.apple.com/trailers/home/rss/newtrailers.rss",
|
40
|
|
- :mode => "on_change",
|
41
|
|
- :type => "xml",
|
42
|
|
- :expected_update_period_in_days => 5,
|
43
|
|
- :extract => {
|
44
|
|
- :title => {:css => "item title", :text => true},
|
45
|
|
- :url => {:css => "item link", :text => true}
|
|
39
|
+ 'url' => "http://trailers.apple.com/trailers/home/rss/newtrailers.rss",
|
|
40
|
+ 'mode' => "on_change",
|
|
41
|
+ 'type' => "xml",
|
|
42
|
+ 'expected_update_period_in_days' => 5,
|
|
43
|
+ 'extract' => {
|
|
44
|
+ 'title' => { 'css' => "item title", 'text' => true},
|
|
45
|
+ 'url' => { 'css' => "item link", 'text' => true}
|
46
|
46
|
}
|
47
|
47
|
}).save!
|
48
|
48
|
end
|
|
|
@@ -52,13 +52,13 @@ unless user.agents.where(:name => "Rain Notifier").exists?
|
52
|
52
|
:name => "Rain Notifier",
|
53
|
53
|
:source_ids => user.agents.where(:name => "SF Weather Agent").pluck(:id),
|
54
|
54
|
:options => {
|
55
|
|
- :expected_receive_period_in_days => "2",
|
56
|
|
- :rules => [{
|
57
|
|
- :type => "regex",
|
58
|
|
- :value => "rain|storm",
|
59
|
|
- :path => "conditions"
|
|
55
|
+ 'expected_receive_period_in_days' => "2",
|
|
56
|
+ 'rules' => [{
|
|
57
|
+ 'type' => "regex",
|
|
58
|
+ 'value' => "rain|storm",
|
|
59
|
+ 'path' => "conditions"
|
60
|
60
|
}],
|
61
|
|
- :message => "Just so you know, it looks like '<conditions>' tomorrow in <location>"
|
|
61
|
+ 'message' => "Just so you know, it looks like '<conditions>' tomorrow in <location>"
|
62
|
62
|
}).save!
|
63
|
63
|
end
|
64
|
64
|
|
|
|
@@ -66,7 +66,7 @@ unless user.agents.where(:name => "Morning Digest").exists?
|
66
|
66
|
Agent.build_for_type("Agents::DigestEmailAgent", user,
|
67
|
67
|
:name => "Morning Digest",
|
68
|
68
|
:schedule => "6am",
|
69
|
|
- :options => { :subject => "Your Morning Digest", :expected_receive_period_in_days => "30" },
|
|
69
|
+ :options => { 'subject' => "Your Morning Digest", 'expected_receive_period_in_days' => "30" },
|
70
|
70
|
:source_ids => user.agents.where(:name => "Rain Notifier").pluck(:id)).save!
|
71
|
71
|
end
|
72
|
72
|
|
|
|
@@ -74,6 +74,6 @@ unless user.agents.where(:name => "Afternoon Digest").exists?
|
74
|
74
|
Agent.build_for_type("Agents::DigestEmailAgent", user,
|
75
|
75
|
:name => "Afternoon Digest",
|
76
|
76
|
:schedule => "5pm",
|
77
|
|
- :options => { :subject => "Your Afternoon Digest", :expected_receive_period_in_days => "7" },
|
|
77
|
+ :options => { 'subject' => "Your Afternoon Digest", 'expected_receive_period_in_days' => "7" },
|
78
|
78
|
:source_ids => user.agents.where(:name => ["iTunes Trailer Source", "XKCD Source"]).pluck(:id)).save!
|
79
|
79
|
end
|